#include "fepch.h"
#include "Light.h"
#include "FysicsEngine/Renderer/Renderer.h"
#include "FysicsEngine/Application.h"
#include "FysicsEngine/Imgui/EditorUI.h"

namespace Fysics
{
	Light::Light(glm::vec3 Position, glm::vec3 Color)
		:Item("Light", Position), m_Color(Color)
	{
	}

	void Light::ShowEditPanel()
	{
		if (EditorUI::TreeNode("Position"))
		{
			EditorUI::DragFloat("Position x", &m_Position.x, -50.f, 50.f);
			EditorUI::DragFloat("Position y", &m_Position.y, -50.f, 50.f);
			EditorUI::DragFloat("Position z", &m_Position.z, -50.f, 50.f);
			EditorUI::TreePop();
		}
	}

	void Light::Draw()
	{
		Application& app = Application::Get();
		Renderer::PushObject(this);
		Renderer::Submit(app.GetShader(3), app.GetVertexArray(VA_BOX_LIGHT));
	}

	void Light::Run(Timestep time)
	{
		Renderer::UpdateLight(this);
	}
}
